/******************************************************************************
*
*               Copyright Mentor Graphics Corporation 2003
*                           All rights reserved
*
*   THIS WORK CONTAINS TRADE SECRETS AND PROPRIETARY INFORMATION WHICH IS
*    THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS
*                        SUBJECT TO LICENSE TERMS
*
*******************************************************************************

*******************************************************************************
* FILE NAME                                                          VERSION
* act_call_stack_test.c                                                1.1
*
* COMPONENT
* ANSI/ISO C test application
*
* DESCRIPTION
* Recursive functions designed to verify correct behavior of stack
*
* DATA STRUCTURES
*
*
* FUNCTIONS
* int act_recursive_func( int value )
* int act_call_stack_test(int value)
*
* DEPENDENCIES
* act_test.h
******************************************************************************/

#include "act_test.h"

#if ACT_CALL_STACK_TEST

/******************************************************************************
* FUNCTION
* int act_recursive_func( int value )
*
* DESCRIPTION
* Recursive test function that checks to see if a variable is > 0. If it is,
* decrement and recurse sending the variable as parameter
*
* INPUTS
* int value
*
* OUTPUTS
* int value
******************************************************************************/
int act_recursive_func( int value )
{
     if (value > 0)
     {
          value -= 1;
          value = act_recursive_func(value);
     }
     return value;
}

/******************************************************************************
* FUNCTION
* int act_call_stack_test(int value)
*
* DESCRIPTION
* Initiates the recursive function act_recursive_func(int)
*
* INPUTS
* int value
*
* OUTPUTS
* int
******************************************************************************/
int act_call_stack_test(int value)
{
     int theValue = 10;

     theValue = act_recursive_func(theValue);

     return value + theValue;
}

#endif
